package AbstractTransaction

import (
	"PaySalary/DataBase"
	"PaySalary/Model"
	"PaySalary/ModelImplementation"
)

type ClassificationTransaction interface {
	GetClassification() Model.PaymentClassification
	GetSchedule() Model.PaymentSchedule
}

type AddEmployeeTransaction struct {
	ClassificationTransaction
	itsEmpId   int
	itsName    string
	itsAddress string
}

func (transaction *AddEmployeeTransaction) Execute() {
	pc := transaction.GetClassification()
	ps := transaction.GetSchedule()
	pm := ModelImplementation.HoldMethod{}
	e := Model.SEmployee(transaction.itsEmpId, transaction.itsName, transaction.itsAddress)
	e.SetSchedule(ps)
	e.SetClassification(pc)
	e.SetMethod(pm)
	DataBase.TheInstance.AddEmployee(e.GetEmpid(), e)
}
